package com.kafka.testp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * 作者: LCG
 * 日期: 2020/6/18 23:41
 * 描述:
 */
@Component
public class KafKaProvider {

    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;


    //发送消息方法
    public void send() {
        for(int i=0;i<2;i++){
            kafkaTemplate.send("hello3",UUID.randomUUID().toString()+"==>"+i);
        }
    }

}
